<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    
  </style>
</head>
<body>
  
</body>
<script>

  var obj = {
    name:"Admin",
    age:18,
    sex:"男"
  }
  
  console.log( obj );
  
  console.log( obj.name );
  console.log( obj.age );
  console.log( obj.sex );

  console.log( obj["name"] );
  console.log( obj["age"] );
  console.log( obj["sex"] );
  
  // console.log( obj[sex] );   // error: sex is no defined

  var msg = "age";
  console.log( obj[msg] );


</script>
</html>